package com.crm.action;
import java.util.Map;
import java.util.Set;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.beans.factory.annotation.Autowired;
import com.crm.pojo.Deal;
import com.crm.pojo.User;
import com.crm.service.DealService;

@Namespace("/deal")
public class DealAction implements SessionAware {
	private DealService dealService;
	private Set<Deal> dealSet;
	private Map<String,Object> session;
	private User user;
	
	
	public String execute(){
		user=(User) session.get("user");
		System.out.println(user.getUserName());
		//dealSet=user.getDealSet();
		dealSet=dealService.findDealListByUserId(user);
		return "success";
	}
	
	
	@Action("add")
	public String addDeal(){
		return "success";
	}
	@Action("edit")
	public String editDeal(){
		return "success";
	}
	@Action("detail")
	public String detail(){
		
		return "success";
	}
	
	public String save(){
		user=(User) session.get("user");
		
		
		
		
		return "success";
	}
	
	@Autowired
	public void setDealService(DealService dealService) {
		this.dealService = dealService;
	}

	public Set<Deal> getDealSet() {
		return dealSet;
	}

	public void setDealSet(Set<Deal> dealSet) {
		this.dealSet = dealSet;
	}

	public void setSession(Map<String, Object> session) {
		this.session=session;
	}
	
	
	
	
}
